import { PropType } from 'vue';
import { ILayoutOpts, IParam } from '@/core';

declare type labelPos = 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' | 'NONE';
declare type contentType = 'RAW' | 'HTML' | 'IMAGE' | 'MARKDOWN';
declare type tempMode = 0 | 1 | 2;

export const formProps = {
	name: {
		type: String,
		default: '',
	},
	data: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
};
export const formItemProps = {
	name: {
		type: String,
		default: '',
	},
	slotStyle: {
		type: Object,
	},
	slotClass: {
		type: String,
	},
	label: {
		type: String,
	},
	showLabel: {
		type: Boolean,
		default: true,
	},
	emptyCaption: {
		type: Boolean,
		default: false,
	},
	labelWidth: {
		type: Number,
	},
	labelPos: {
		type: String as PropType<labelPos>,
		default: 'LEFT',
	},
	rules: {
		type: Object,
		default: () => {},
	},
	error: {
		type: String,
	},
	enableAnchor: {
		type: Boolean,
		default: false,
	},
	labelClass: {
		type: String,
	},
};
export const formPageProps = {
	layoutOpts: {
		type: Object as PropType<ILayoutOpts>,
		default: () => {},
	},
};
export const formGroupProps = {
	name: {
		type: String,
		default: '',
	},
	title: {
		type: String,
	},
	slotStyle: {
		type: Object,
	},
	slotClass: {
		type: String,
	},
	imgPath: {
		type: String,
	},
	iconClass: {
		type: String,
	},
	labelCssName: {
		type: String,
	},
	layoutOpts: {
		type: Object as PropType<ILayoutOpts>,
		default: () => {},
	},
	infoGroupMode: {
		type: Boolean,
		default: false,
	},
	titleBarCloseMode: {
		type: Number,
		default: 0,
	},
	showCaption: {
		type: Boolean,
		default: true,
	},
	enableAnchor: {
		type: Boolean,
		default: false,
	},
	uIActionGroup: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	showMoreItems: {
		type: Array,
		default: () => [],
	},
	showMoreMode: {
		type: Number,
		default: 0,
	},
};
export const formTabPageProps = {
	layoutOpts: {
		type: Object as PropType<ILayoutOpts>,
		default: () => {},
	},
};
export const formIframeProps = {
	name: {
		type: String,
		default: '',
	},
	iFrameUrl: {
		type: String,
	},
};
export const formRawProps = {
	name: {
		type: String,
		default: '',
	},
	value: {
		type: String,
		default: '',
	},
	iconClass: {
		type: String,
		default: '',
	},
	imgPath: {
		type: String,
		default: '',
	},
	contentType: {
		type: String as PropType<contentType>,
		default: 'RAW',
	},
	rawStyle: {
		type: String,
	},
};
export const formButtonProps = {
	name: {
		type: String,
		default: '',
	},
	caption: {
		type: String,
	},
	disabled: {
		type: Boolean,
		default: false,
	},
	iconClass: {
		type: String,
	},
	imgPath: {
		type: String,
	},
	showCaption: {
		type: Boolean,
		default: true,
	},
	labelCssName: {
		type: String,
	},
	uIAction: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
};
export const formDruipartProps = {
	name: {
		type: String,
		default: '',
	},
	paramItem: {
		type: String,
		default: '',
	},
	context: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	viewParams: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	parentName: {
		type: String,
		default: '',
	},
	refreshItems: {
		type: String,
		default: '',
	},
	data: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	localContext: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	localViewParams: {
		type: Object as PropType<IParam>,
		default: () => {},
	},
	tempMode: {
		type: Number as PropType<tempMode>,
		default: 0,
	},
	viewName: {
		type: String,
		default: '',
	},
	userTag: {
		type: String,
	},
	userTag2: {
		type: String,
	},
};
